/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.osdtsystem.utils;

import gnu.trove.TLongArrayList;
import java.util.AbstractList;

/**
 *
 * @author mwh
 */
public class TroveLongList extends AbstractList<Long> implements Trimmable{

    TLongArrayList list;

    public TroveLongList() {
        list = new TLongArrayList();
    }

    public TroveLongList(int capacity) {
        list = new TLongArrayList(capacity);
    }

    public TroveLongList(long[] array) {
        list = new TLongArrayList(array);
    }

    @Override
    public Long get(int index) {
        return list.get(index);
    }

    @Override
    public int size() {
        return list.size();
    }

    @Override
    public Long set(int index, Long element) {
        long oldvalue = list.get(index);
        list.set(index, element);
        return oldvalue;
    }

    @Override
    public boolean  add(Long element) {
      list.add(element);
      return true;
    }

    @Override
    public void add(int index, Long element) {
        throw new UnsupportedOperationException();
    }

    @Override
    public Long remove(int index) {
        return list.remove(index);
    }

    @Override
    public void trimToSize() {
        list.trimToSize();
    }
}
